﻿@model IEnumerable<VehicleManagement.Models.CarInfo>

@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@*<script type="text/javascript">
    $(function () {
        //        alert($.query.get("DriverName"));
        $.post("/CarInfo/GetPagingInfo", {},
            function (data) {
                $("#TotalItems").text(data.TotalItems);
                $("#ItemsPerPage").text(data.ItemsPerPage);
                $("#TotalPages").text(data.TotalPages);
                $("#CurrentPage").text(data.CurrentPage);
            });
    });
</script>*@
<script src="@Url.Content("~/Scripts/SetPagingScript.js")" type="text/javascript"></script>
<script type="text/javascript">

    $(function () {
        if ($.query.get("Page") != "") {
            $("#Page").val($.query.get("Page"));
        }
        else {
            $("#Page").val(1);
        }

        if ($.query.get("CarNum") != "" && !$.query.get("CarNum")) {
            $("input[name='CarNum']").val($.query.get("CarNum"));
        }

        if ($.query.get("CarAvailable") != "" && !$.query.get("CarAvailable")) {
            $("input[name='CarAvailable']").val($.query.get("CarAvailable"));
        }

        if ($.query.get("CarState") != "" && !$.query.get("CarState")) {
            $("input[name='CarState']").val($.query.get("CarState"));
        }

        if ($.query.get("CarType") != "" && !$.query.get("CarType")) {
            $("input[name='CarType']").val($.query.get("CarType"));
        }

        $.get("/CarInfo/GetPagingInfo",
            {
                CarNum: $("input[name='CarNum']").val(),
                CarAvailable: $("input[name='CarAvailable']").val(),
                CarState: $("input[name='CarState']").val(),
                CarType:$("input[name='CarType']").val(),
                Page: $("#Page").val()
            },
            function (data) {
                $("#TotalItems").text(data.TotalItems);
                $("#ItemsPerPage").text(data.ItemsPerPage);
                $("#TotalPages").text(data.TotalPages);
                $("#CurrentPage").text($("#Page").val());
            }
        );
        SetPagingOperation();
    });
    function DeleteAddGas(id) {
        if (confirm("你确认删除这条加油信息吗?")) {
            $.post("/AddGas/DeleteAddGas", "id=" + id, function (ret) {
                if (ret.Result == "true") {
                    alert(ret.Message);
                    window.location.reload();
                }
                else {
                    alert(ret.Message);
                }
            }, "json");
        }
    }
</script>
@*<h2>车辆信息</h2>*@
<div class="mas">
<div class="toptitle">
   司机负责人管理平台
</div>
@*<div class="car"></div>*@
@Html.Partial("_PartviewDriverManager")
<div class="rightshow">
<h2></h2>
 <div class="wrap-right">
        <div class="classifyinfo">
            <div class="system-location">
                <a>管理系统</a>>><a>车辆管理</a>>><a>用车申请</a>
            </div>
            <div class="system-Userinfo">
                <span class="space">当前用户:</span><a>张测试</a><span class="space">部门:</span><a>技术部</a><a class="space">退出</a>
            </div>
            <div class="clear"></div>
        </div>
         <div class="contrlcar">     
        </div>
        <div class="sort-content">
            <div class="car-sort-bar">
               
               <ul>
                    <li><a href="../../CarInfo/Index"><span>车辆信息</span></a></li>
                    <li><a href="../../Accident/Index"><span>车辆事故</span></a></li>
                    <li><a href="../../BreakRules/Index"><span>车辆违章</span></a></li>
                    <li><a href="../../CarInsure/Index"><span>车辆保险</span></a></li>
                    <li><a href="../../Fix/Index"><span>车辆维修</span></a></li>
                    <li><a href="../../CarParts/Index"><span>车辆配件</span></a></li>
               </ul>

            </div>
            <div class="sort-bar">
                    <div class="sort-bar-item">
                        车辆条件筛选：
                    </div>
                    @using (Html.BeginForm("Index", "CarInfo", FormMethod.Get, FormMethod.Get, new { id = "SearchForm" }))
                    {
                        @Html.Hidden("Page");
                        <div class="sort-bar-item1">
                            <input id="key" name="CarNum" type="text" value="车牌号" class="ipt-2" /><input type="submit"
                                value="" class="btn-2" />
                        </div>
                        <div class="sort-bar-item1">
                            <select id="sort-bar-item-select1" name="CarAvailable">
                                <option selected="selected">是否空闲</option>
                                <option>是</option>
                                <option>否</option>
                            </select>
                        </div>
                        <div class="sort-bar-item1">
                            <select id="sort-bar-item-select3" name="CarState">
                                <option selected="selected">是否可用</option>
                                <option>可用</option>
                                <option>不可用</option>
                            </select>
                        </div>
                        <div class="sort-bar-item1">
                            <select id="sort-bar-item-select2" name="CarType">
                                <option selected="selected">车辆类型</option>
                                <option>A1大型客车</option>
                                <option>A2牵引车</option>
                                <option>B1中型客车</option>
                                <option>C1小型轿车</option>
                                <option>C2小型自动挡汽车</option>
                            </select>
                        </div>
                        <div class="sort-bar-item2">
                            <input id="Text3" name="key" type="submit" value="模糊查找" class="ipt-2" /><input type="submit"
                                value="" class="btn-2" />
                        </div>
                    }
                    <div class="clear">
                    </div>
                </div>
             <div class="createrecordp">
                <div class="createrecord_pbc">
                    <div class="createrecord_pbc1">@Html.ActionLink("添加新车辆", "Create")</div>
                </div>
            </div>
           
 
<div class="sort-info">
@foreach (var item in Model)
{
    <div class="sort-info1">
                    <div class="img-wrap">
                        <img src="../../Content/themes/base/DMSource/png-0840.png" />
                    </div>
                    <div class="sort-info-text">
                    <div class="sort-info-line1">
                        <div class="sort-info-a"> <a>@Html.DisplayFor(model => item.CarNumber)</a></div>
                        <div class="sort-info-btn2"> @Html.ActionLink("查看", "Details", new { id = item.CarID })</div>
                        <div class="sort-info-btn2"> @Html.ActionLink("编辑", "Edit", new { id = item.CarID })</div>
                        <div class="sort-info-btn2"> <a href="javascript:void(0)" onclick="DeleteCar(@item.CarID)">删除</a></div>
                         <div class="clear"></div>                     
                    </div>
                    <div class="sort-info-line2">
                        <span>@Html.LabelFor(model => item.CarState):</span> <a>@Html.DisplayFor(model => item.CarState)</a> 
                        <span>@Html.LabelFor(model => item.CarType):</span> <a>@Html.DisplayFor(model => item.CarType)</a> 
                        <span class="sort-info-span2">@Html.LabelFor(model => item.Remark):</span> <a>@Html.DisplayFor(model => item.Remark)</a>
                    </div>
                    </div>
                    <div class="clear"></div>
                </div>
           

}
<div>
    共<span id="TotalItems"></span>条记录， 每页显示<span id="ItemsPerPage"></span>条， 共<span id="TotalPages"></span>页，
    当前第<span id="CurrentPage"></span>页 <a id="FirstPage" href="javascript:void(0)">首页</a>
    <a id="PrevPage" href="javascript:void(0)">上一页</a> <a id="NextPage" href="javascript:void(0)">
        下一页</a> <a id="LastPage" href="javascript:void(0)">末页</a> <span>跳转到</span>
    <input type="text" id="PageToGo" />
    <input type="button" id="GoToPage" value="Go" />
</div>
 </div>
</div>
</div>


<div class="clear"></div>
	
</div>
</div>
